	//////////////////////////////////////
//author:Leonel Wong
//create time:2008-7-9 8:27:44
//ramark:just for use it
//////////////////////////////////////
var httpReq = null;
//create a xmlreqeuest object
function AJAX(m,u,f,s){
	this.method=m;
	this.url=u;
	this.refresh=f;
	this.sendInfo=s;
}
function createXmlRequest() {
    var _msxmlhttp = new Array(   
        'Msxml2.XMLHTTP.5.0',   
        'Msxml2.XMLHTTP.4.0',   
        'Msxml2.XMLHTTP.3.0',   
        'Msxml2.XMLHTTP',   
        'Microsoft.XMLHTTP');   
    for(var i = 0; i < _msxmlhttp.length; i++) {   
        try {   
            if(httpReq = new ActiveXObject(_msxmlhttp[i])) {
            	break;   
            }
        } catch (e) {   
            httpReq = null;   
        }   
    }   
    if(!httpReq && typeof XMLHttpRequest != "undefined"){   
        httpReq = new XMLHttpRequest();   
    }
    if(!httpReq){  
        alert("Could not create connection object.");   
    }
}
		//contorl 
function contorl(method, url, refresh, sendStr) {
	createXmlRequest();
	//alert(httpReq);
	if (httpReq != null) {
		httpReq.open(method, url, refresh);
		showMessage('please wait some second...','reading...');
		var msgBoxDiv=document.getElementById('msgBoxDiv');
		var msgTitle=document.getElementById('msgTitle');
		httpReq.onreadystatechange = callback;
		httpReq.send(null);
	}
}
//回调函数，返回是否处理成功
/*
function callback() {
	if (isSuccess()) {
		var xmlR=httpReq.responseXML;
		if(xmlR.length>0){
			var loginTime=xmlR.getElementsByTagName('loginTime')[0].firstChild.nodeValue;
			msgBoxDiv.innerHTML='您在'+loginTime+'成功登录!';
		}else{
			window.alert('sorry,your name and pass is error!');
		}
	}
	closeInTime();
}
*/
		//获得处理状态
function isSuccess() {
	var isOver=false;
	//处理，并且封闭屏幕，显示状态和消息
	//window.alert(parseInt(httpReq.readyState));
	switch(parseInt(httpReq.readyState)){
		//（0=未初始化，1=正在加载，2=已经加载，3=交换中，4=完成
		case 0:	
			msgBoxDiv.innerHTML='init...';
			break;
		case 1:	
			msgBoxDiv.innerHTML='start loading...';
			break;
		case 2:	
			msgBoxDiv.innerHTML='end loading...';
			break;
		case 3:	
			msgBoxDiv.innerHTML='data exchanging...';
			break;
		case 4:	
			msgBoxDiv.innerHTML='over...';
			break;
		default:	
			break;
	}
	if(httpReq.readyState==4){
		if(httpReq.status==200){
				isOver=true;
		}else{
			msgBoxDiv.innerHTML='error:\ncode('+status+')\ttext('+statusText+')';    	
			closeAlert();
		}
	}
	return isOver;
}
		//弹出消息显示
function showMessage(title, message) {
	var shield = document.createElement("DIV");
	shield.id = "shield";
	shield.style.position = "absolute";
	shield.style.left = "0px";
	shield.style.top = "0px";
	shield.style.width = "100%";
	shield.style.height = "100%";//document.body.scrollHeight + "px";
	shield.style.background = "#005056";
	shield.style.textAlign = "center";
	shield.style.zIndex = "10000";
	shield.style.filter = "alpha(opacity=0)";
	shield.style.opacity = 0;
	var alertFram = document.createElement("DIV");
	alertFram.id = "alertFram";
	alertFram.style.filter = "alpha(opacity=95)";
	alertFram.style.background = "white";
	alertFram.style.position = "absolute";
	alertFram.style.left = "50%";
	alertFram.style.top = "100px";
	alertFram.style.margin = "0 0 0 -325px";
	alertFram.style.width = "650px";
	alertFram.style.height = "310px";
	alertFram.style.zIndex = "10001";
	strHtml = "<table style='width:100%;'>";
	strHtml += "<tr>";
	strHtml += "<td style='background:#bfe8ea;width:100%;height=20px;' align='center' onclick='closeAlert();'><label id='msgTitle'><strong>" + title + "</strong></label>";
	strHtml += "</td></tr>";
	strHtml += "<tr><td style='width:100%;' align='center'><font size='25px'><div id='msgBoxDiv'>" + message + "</div></font></td>";
	strHtml += "</tr></table>";
	alertFram.innerHTML = strHtml;
	document.body.appendChild(alertFram);
	document.body.appendChild(shield);
	this.setOpacity = function (obj, opacity) {
		if (opacity >= 1) {
			opacity = opacity / 100;
		}
		try {
			obj.style.opacity = opacity;
		}
		catch (e) {
		}
		try {
			if (obj.filters.length > 0 && obj.filters("alpha")) {
				obj.filters("alpha").opacity = opacity * 100;
			} else {
				obj.style.filter = "alpha(opacity=\"" + (opacity * 100) + "\")";
			}
		}
		catch (e) {
		}
	};
	var c = 0;
	this.doAlpha = function () {
		if (++c > 20) {
			clearInterval(ad);
			return 0;
		}
		setOpacity(shield, c);
	};
	var ad = setInterval("doAlpha()", 1);
	this.doOk = function () {
		document.body.removeChild(alertFram);
		document.body.removeChild(shield);
		document.body.onselectstart = function () {
			return true;
		};
		document.body.oncontextmenu = function () {
			return true;
		};
	};
	document.body.onselectstart = function () {
		return false;
	};
	document.body.oncontextmenu = function () {
		return false;
	};
}
		//关闭消息显示
function closeAlert() {
	if (document.getElementById("shield") != null) {
		document.body.removeChild(document.getElementById("shield"));
		document.body.removeChild(document.getElementById("alertFram"));
	}
}

var secs = 5;
var icount=0;
function closeInTime() {
	window.setTimeout("closeInTime(" + icount + ")", icount * 1000);
	if(icount == secs) {
		closeAlert();
	}
	else if((secs-icount)>=0){
		printnr = secs-icount;
		msgTitle.innerHTML=printnr +"秒后自动关闭！)";
	}
	icount++;
}